UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'es6Q4thaRR/0qEZaXesHgBwdSh/zDvF1h0vxCyEU6+A='
WHERE
key_id = '9ec116bea56b6de178234b16a2bb053acc54ef94448a779ab416f47d045e29f4'
AND (
token = 'es6Q4thaRR/0qEZaXesHgBwdSh/zDvF1h0vxCyEU6+A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)