UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KL1Wx45wNtFfkdyM80t1k9LCPY7RLQSf6mPlevsqP+k=' 
WHERE 
  key_id = '785d086df51f609be33ba20a851174dbf7647fa71faf52dbb0f782fcf6c6f956' 
  AND (
    token = 'KL1Wx45wNtFfkdyM80t1k9LCPY7RLQSf6mPlevsqP+k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018