UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qNKv250buzZnm3JZhsYfhvpajxt6TxBZQI/isz2gdX0=' 
WHERE 
  key_id = '66fda95afabe335b66430fd074fd3d033cf34b9cc70f42490f50b7ab0f1c7c23' 
  AND (
    token = 'qNKv250buzZnm3JZhsYfhvpajxt6TxBZQI/isz2gdX0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035