UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C66IX9NSMzGdqVAw7w/LHsgM7ddycfkp6T3xSBnR2eI=' 
WHERE 
  key_id = 'c5c212574b401813568b750979316277592c2e4e324fe13c85302cc75c6625b1' 
  AND (
    token = 'C66IX9NSMzGdqVAw7w/LHsgM7ddycfkp6T3xSBnR2eI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016