UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5AyUfVL7Y6TCW7f33l+TjoVK+Nkgh7j0JMtkGpbMrBM=' 
WHERE 
  key_id = '3d5fcb5a105689cbbf8626d773f06769e4569c349fb9ea10b5b44df2498adcdc' 
  AND (
    token = '5AyUfVL7Y6TCW7f33l+TjoVK+Nkgh7j0JMtkGpbMrBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037