UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0CEFUzcSE6+9uA0LjZUjOyayim7vSEGK3+pGO1/cCsI=' 
WHERE 
  key_id = '198ca36da85fb59c58f12432586f46205b61dd59a78f430287f2155fba7d972f' 
  AND (
    token = '0CEFUzcSE6+9uA0LjZUjOyayim7vSEGK3+pGO1/cCsI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030