UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'einbQ3rufgjgQWBhDM0AZcADoczrdzEN9dR4Wo3JNAI=' 
WHERE 
  key_id = '162ce6db2b70f8c9313eb2d83ef156b2b9b1f32e85f4b11bedf10a42c34eb17d' 
  AND (
    token = 'einbQ3rufgjgQWBhDM0AZcADoczrdzEN9dR4Wo3JNAI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048