UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w9px5QGY2bzZ47hvHFYpRPENPQwZkzUVZrDtCoK5aAM=' 
WHERE 
  key_id = '6762e64abe14da5c57b8930018eb09c9fdd93748ded6b46b89a350f3859667e6' 
  AND (
    token = 'w9px5QGY2bzZ47hvHFYpRPENPQwZkzUVZrDtCoK5aAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033