UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9/MDeulO8PVFhQfksX6P7yt5aXHOgYhrNz444NpKIY4=' 
WHERE 
  key_id = '0bfef574f6674c30066227b43556c784a05cb577861237249aad3bda5dcdedb3' 
  AND (
    token = '9/MDeulO8PVFhQfksX6P7yt5aXHOgYhrNz444NpKIY4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018