UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BeuFlncgnwxM825UDwoJwl7jjkg2E2P5s2M7vFa6MZU=' 
WHERE 
  key_id = '6d1863aa038a63dc83d93a42c912aa813feaf892b9feab07dc4a9adb7009a049' 
  AND (
    token = 'BeuFlncgnwxM825UDwoJwl7jjkg2E2P5s2M7vFa6MZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00058