UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KMndAFsZ547CebhLBa7XQWdWTGU5J7SjSUviy2RNdH0='
WHERE
key_id = 'e1524b10ab6e5483d8a114cc86d07039e3bd26d67143c29ab47b8ef83da5c6e0'
AND (
token = 'KMndAFsZ547CebhLBa7XQWdWTGU5J7SjSUviy2RNdH0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)