UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uKUroaY7Zuf8zRoH+z+fFGRVEVGdhmSDFtBVMok37fs=' 
WHERE 
  key_id = '185ae5f422f94147491507d0578e0ce8f35036f76f3a8f5d3ac020e422b493a6' 
  AND (
    token = 'uKUroaY7Zuf8zRoH+z+fFGRVEVGdhmSDFtBVMok37fs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032