UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cGEUtrfmQxM7HrmXX840LWuQoSE9ZygM2T9xAmgJ2w4='
WHERE
key_id = '4fc7cd8d04ede22eb0ccd72320d8416a1a4ef58d52597a920b75f7878c7805a3'
AND (
token = 'cGEUtrfmQxM7HrmXX840LWuQoSE9ZygM2T9xAmgJ2w4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)