UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hz43I7fbN02wB0/ElnSL5AM8c04CZ4P3kMNCzntKYfE='
WHERE
key_id = 'b6e0fab9ccff7b8e2b710118aa929068aa17422e2b628e8733dd46bf1507eb06'
AND (
token = 'Hz43I7fbN02wB0/ElnSL5AM8c04CZ4P3kMNCzntKYfE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)