UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cGMTiDQbKCZKdrS+n0Zgk91i819RtD6JziersuEr8uU=' 
WHERE 
  key_id = 'c62739e3e0f1d2f6290f5633a89dd85b554e6601e5841e4936de637a78fd093d' 
  AND (
    token = 'cGMTiDQbKCZKdrS+n0Zgk91i819RtD6JziersuEr8uU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050