UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9+AoGqKSquNw7r/2zkjHeQEQYcEhihZ/F87G7YbJ258=' 
WHERE 
  key_id = '489b358b55cf13026de788599943db2dede333e5162379f2e5681985fad7638e' 
  AND (
    token = '9+AoGqKSquNw7r/2zkjHeQEQYcEhihZ/F87G7YbJ258=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023