UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0ehTGBeCpAYdvJzoI1Jw4T7P2GEZLVSCB0waq6ZSx+I='
WHERE
key_id = 'aac1131eff32754fe2623efa273a5536b4ada73bc4ce12f04133527d73bc20b5'
AND (
token = '0ehTGBeCpAYdvJzoI1Jw4T7P2GEZLVSCB0waq6ZSx+I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)