UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f4kpXjoMJS7QwHB8yzbGDSpba9HUkiUzlKZL+j1ua9M=' 
WHERE 
  key_id = 'd0425834f197e6475418ea9c5d93465e3dfc25963ecef24bdc3d91b544268a30' 
  AND (
    token = 'f4kpXjoMJS7QwHB8yzbGDSpba9HUkiUzlKZL+j1ua9M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050