UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BRq0YEFsujnOVG0m/4ly9A/46imuwdsKKUTwTLUfW/4='
WHERE
key_id = 'b8978af4736af87018204ea96e3d6b220976568a48d0e9b6e315c4cdf5b9b60c'
AND (
token = 'BRq0YEFsujnOVG0m/4ly9A/46imuwdsKKUTwTLUfW/4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)