UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7YTyjt35RzLQ0fsLse1G7R/9hPkZethHjpNZTyXycsU=' 
WHERE 
  key_id = '4736aa284b98944610d9998e430241b1f912de85312de8a2200481cf47c376ee' 
  AND (
    token = '7YTyjt35RzLQ0fsLse1G7R/9hPkZethHjpNZTyXycsU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026