UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9H+TqTcz5lPnu0uHjwYhzhgb5nwlUEVEhgC1MKGAj2E=' 
WHERE 
  key_id = 'c949bd68707900947e8fb1ec4d0c0c376b057fbae654c3161bf45cc3c4665929' 
  AND (
    token = '9H+TqTcz5lPnu0uHjwYhzhgb5nwlUEVEhgC1MKGAj2E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023