UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'khWgzCFEGElaDbUdByJhge1OdA+SiouYqB90BLc0zKU=' 
WHERE 
  key_id = '6552007de63e85d43ae2eb750deda05c2be559d2749e581ebdb8686772d8404c' 
  AND (
    token = 'khWgzCFEGElaDbUdByJhge1OdA+SiouYqB90BLc0zKU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042