UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5nNu11Ati1/8LIY+YgB2upYu0kgda4obe/ZnzPvOPxE=' 
WHERE 
  key_id = 'f4bf76f24514d77c712c9277012f7a81d323b65f5b798b14ab03b3961cef7343' 
  AND (
    token = '5nNu11Ati1/8LIY+YgB2upYu0kgda4obe/ZnzPvOPxE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030