UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1WNYyMwIZRWU4cjxv69L02k1rKLudZfavF5ivADRWOk=' 
WHERE 
  key_id = '0729698b4f6045e09714fc8e5f80e1d871867ace72001377492f8903e9ab2043' 
  AND (
    token = '1WNYyMwIZRWU4cjxv69L02k1rKLudZfavF5ivADRWOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020