UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1f0RoiXP3b+VH1AiNIWkVf2E2t3CZKRwzGpr+vUZaY0='
WHERE
key_id = 'fbcec5dc823cbea3a7396bb144e01ea0ed5de097c77dcbaed014b7e929e9b983'
AND (
token = '1f0RoiXP3b+VH1AiNIWkVf2E2t3CZKRwzGpr+vUZaY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)