UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ccsz4ctYlfweVjZH6s9zJTHsN/PR5VMccNADO6G2t+k=' 
WHERE 
  key_id = '23370c5c1388485269b21ded650c6374a23a6e2c82952046da036ef57fddf84d' 
  AND (
    token = 'ccsz4ctYlfweVjZH6s9zJTHsN/PR5VMccNADO6G2t+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025