UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '395AWv5R5Czj1wHKkPu1KlyJ6wTf41chdSxag4qUmbA=' 
WHERE 
  key_id = '45e666bdefa88b078e3d8854ac9f63bcf0701c67bdee3fffc7720308622859cc' 
  AND (
    token = '395AWv5R5Czj1wHKkPu1KlyJ6wTf41chdSxag4qUmbA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032