UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hin1kWekskaL2H9yuyMpUZkoX+EcMkWRxo4mnB6dt0Q=' 
WHERE 
  key_id = '24ebd2cc510b72fd52c8d7170a023f16c3e5f1985ff788b54f0b7f33d9732176' 
  AND (
    token = 'hin1kWekskaL2H9yuyMpUZkoX+EcMkWRxo4mnB6dt0Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018