UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ugXYBgdTdKYTjQGp+pTAeqY0pEKJ9GvX1n0RM1yJTN4=' 
WHERE 
  key_id = '3e30dee2daf2985834fec465a0a2519673789f0d1da985b58637acf34370f2df' 
  AND (
    token = 'ugXYBgdTdKYTjQGp+pTAeqY0pEKJ9GvX1n0RM1yJTN4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046