UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CdS/FRAlWrhdgh5ktnWLZlu2pQFZbTmuZh0Pf7SxIK0=' 
WHERE 
  key_id = 'd664735b6284126457714fea7b2ea6c35e132abdd70090ad1367a1dd551d4fc5' 
  AND (
    token = 'CdS/FRAlWrhdgh5ktnWLZlu2pQFZbTmuZh0Pf7SxIK0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031