UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7tbyJ10p5bSWEe8lBAXK7LsTKk+ncLhxm7I09y2nhMI='
WHERE
key_id = 'c54b98d4dd748553c2c1f81612bd6ae480b11b46d99941b595d8dd2885fedf55'
AND (
token = '7tbyJ10p5bSWEe8lBAXK7LsTKk+ncLhxm7I09y2nhMI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)