UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XoGBnZ4DuhhRCErmS6PSYELX4+CzXiFo3yfPdyAD8uE=' 
WHERE 
  key_id = '90dce639ffe4e1adf59f43b739f6728517017dfe31e8fdd5409df407259c2fdb' 
  AND (
    token = 'XoGBnZ4DuhhRCErmS6PSYELX4+CzXiFo3yfPdyAD8uE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039