UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QuptBQ/DbjdkQNFQLSb1J0kWGkiBWpje0rTect0tj0M='
WHERE
key_id = '0f73387dd88489d539bc526612384904a31a66ddb48dc1c4a2a2c81090ba7d1f'
AND (
token = 'QuptBQ/DbjdkQNFQLSb1J0kWGkiBWpje0rTect0tj0M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)