UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sImOd3e/L8lSpAi8mldC4EIJnb0GLMUlbwspunOltkE=' 
WHERE 
  key_id = 'e86975ec546924ddad4f21dcab86561e68d7e0ef8405a25daf677170400b9675' 
  AND (
    token = 'sImOd3e/L8lSpAi8mldC4EIJnb0GLMUlbwspunOltkE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034