UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Jlr1GcNmH8cY8PvCrcaLimhtGcONU5fn9o3TuPchRok=' 
WHERE 
  key_id = '00bf4440e014f4a9ae4fda6e21aedc6b172c60e6d4e10a0f397c2f3839835d9e' 
  AND (
    token = 'Jlr1GcNmH8cY8PvCrcaLimhtGcONU5fn9o3TuPchRok=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045