UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8SCGiPvKvpSkBegNaJSaXFkn7CoxEcUjEJ3HF1gu0kw=' 
WHERE 
  key_id = '45c4859fb47e707039be1db81234f8542d6154810b1ff5599f99d3d8975be80d' 
  AND (
    token = '8SCGiPvKvpSkBegNaJSaXFkn7CoxEcUjEJ3HF1gu0kw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039