UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OBjz7Ic8omKjCx6UvXjXUn2xz4TN6Bxm6qPvjqMgsWA=' 
WHERE 
  key_id = '875f93fd0d96f5717c64defab18ef8a2e1631edcdddbc834afec91cb503a7826' 
  AND (
    token = 'OBjz7Ic8omKjCx6UvXjXUn2xz4TN6Bxm6qPvjqMgsWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047