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

Query time 0.00038