UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YyLqhHnTfeftGvFAaEUXxSazYNp36IY031lkSpiTxfk=' 
WHERE 
  key_id = '7dd4ec78542a54d99a33c62b64ab1e2fa97f8f7dcf52816692cb461e3b0edf1b' 
  AND (
    token = 'YyLqhHnTfeftGvFAaEUXxSazYNp36IY031lkSpiTxfk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026