UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SzgjPqhcWY/HTcwvYyfXKFiTEB+zgAbXii4o1bhn7/U=' 
WHERE 
  key_id = '618fd20bc8b8d17980b2ff65d0e4e97c82cd8a6897d130405916a0ed975da14d' 
  AND (
    token = 'SzgjPqhcWY/HTcwvYyfXKFiTEB+zgAbXii4o1bhn7/U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00055