UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3ZifmRvYB0hia0RHL/SJLGgMeoFZ9Y99abp7KXo3dDU='
WHERE
key_id = 'b45935d504d5eeeb65e56c255775aeda4f1743ef11bc064d58c88ea443910474'
AND (
token = '3ZifmRvYB0hia0RHL/SJLGgMeoFZ9Y99abp7KXo3dDU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)