UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gSXkwMoHRCh0eFFPr4P0cbVIm5epbKQidWZ/Ym/ksvA=' 
WHERE 
  key_id = '793c2a98721e9c86345efbeb5369cef540d77ce0404cc94b9fa1892bb1adfae6' 
  AND (
    token = 'gSXkwMoHRCh0eFFPr4P0cbVIm5epbKQidWZ/Ym/ksvA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028