UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U0vAzFGQ+dRovMjPZuMJI2nIDY6SlQJAPLgxMVIzx7I=' 
WHERE 
  key_id = '272ef537cf430049babd3f17b872f4b98c6abee82ac4c1a1dccea176e590e52f' 
  AND (
    token = 'U0vAzFGQ+dRovMjPZuMJI2nIDY6SlQJAPLgxMVIzx7I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047