UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oebfdcRCBhrWEFjkFsooHT6eaxy6rzeOQYj9k6Jj7hk=' 
WHERE 
  key_id = '5deea9253d6dffaa07f72256e6f8da3793a13876bd490d96cb408547c12469e6' 
  AND (
    token = 'oebfdcRCBhrWEFjkFsooHT6eaxy6rzeOQYj9k6Jj7hk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027