UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xAmAw/2JES8QrAzbS0/0Vc5Oox20jRA5+dX1TjdCLX8=' 
WHERE 
  key_id = '59d2e760eff659f1797936102a9a9e4db59ee4a0fea1e17cb26b7cedbfff8dd0' 
  AND (
    token = 'xAmAw/2JES8QrAzbS0/0Vc5Oox20jRA5+dX1TjdCLX8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032