UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TaH/ELDLcejyHiDchhvQ1W0C6phZPxxUCCs+YMlk8Vw=' 
WHERE 
  key_id = '45ce7ff48afe3661e6e334dfb60c0ac8e7d5408ce974ecb4cf5a4056ecf65326' 
  AND (
    token = 'TaH/ELDLcejyHiDchhvQ1W0C6phZPxxUCCs+YMlk8Vw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022