UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'coAWfpQVI1d4wVeuY08GhAWmoVEJ8kfso6ckpGWg2Ag=' 
WHERE 
  key_id = 'c2dc1ae134a000987465d2a6569ed04d678b125be7650034dbd6d4ad6808f9dc' 
  AND (
    token = 'coAWfpQVI1d4wVeuY08GhAWmoVEJ8kfso6ckpGWg2Ag=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030