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