UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hXTEMj8qRaoIzRQuM+tazuTk+mFxuwkBw36061Eb8Gk=' 
WHERE 
  key_id = '8336a3dd84955e3c52a3525f871752dc26520992142a44e3f5342291bb7b0092' 
  AND (
    token = 'hXTEMj8qRaoIzRQuM+tazuTk+mFxuwkBw36061Eb8Gk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034