UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OAahk4p9YdlbdvU2/UawVaGL5HtgBQhG5MQczCtNkEQ=' 
WHERE 
  key_id = 'e7a5416d571ddb891be4b0fc5616cd7aa57f1f8ac329f8d0cf9d5b69c3641994' 
  AND (
    token = 'OAahk4p9YdlbdvU2/UawVaGL5HtgBQhG5MQczCtNkEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026