UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WiZ3sA+KSE4WJy4UkEKZeMb7HwcbedHrewlfBM9oHt8='
WHERE
key_id = '17e1e41d3019a08303583fb2e10ab9c71f018be95171459b14358486190a1557'
AND (
token = 'WiZ3sA+KSE4WJy4UkEKZeMb7HwcbedHrewlfBM9oHt8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)