UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bXHHBCREK9KAvTv3nwF9Pog9WcNnLOlHK51VY0F8FAs=' 
WHERE 
  key_id = 'ad57f20abec63bd46d52bc703d31c79ad054b6bc60977fdb726bfff62a6b6180' 
  AND (
    token = 'bXHHBCREK9KAvTv3nwF9Pog9WcNnLOlHK51VY0F8FAs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042