UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Hy5z1Q6/woW+7fj1JlpNt3WRrIvOGz+RIFScF6Q0xPQ=' 
WHERE 
  key_id = '5db95a3053fd30bbf1cd2194ad314c7d58a75a6936e78b7ecd0258291345a9d1' 
  AND (
    token = 'Hy5z1Q6/woW+7fj1JlpNt3WRrIvOGz+RIFScF6Q0xPQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041