UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dYvFS1zvXVxgUuekVE27kXltEFxAQ6olpc404cGZ1NY=' 
WHERE 
  key_id = 'fdc875f4fc8f0a662dd7672b50f9851dfc9632aa8d73f66f6ca9500dc4fb9f22' 
  AND (
    token = 'dYvFS1zvXVxgUuekVE27kXltEFxAQ6olpc404cGZ1NY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030