UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U4LhjVjMdrsAOFFxDrOal2g6suCjAT3rPRikysTAT5I=' 
WHERE 
  key_id = '23f9e0e300b0d37593bc07997e24d57eb97d61ec05870c48783ca0efbc67f433' 
  AND (
    token = 'U4LhjVjMdrsAOFFxDrOal2g6suCjAT3rPRikysTAT5I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023