UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1YGGrMbcy+lUlI2Jo+oe2lYF52EtTx8N3Gs/QFL1JH8=' 
WHERE 
  key_id = '220005af8dcb93b250c4850aece9f536f50f64520c81843b4d8cc7ff867360b5' 
  AND (
    token = '1YGGrMbcy+lUlI2Jo+oe2lYF52EtTx8N3Gs/QFL1JH8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038