UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W1JIiqkGKsxmLHkET0nQ+3WqByaXBGTo/fyuulZLtLo='
WHERE
key_id = '5dfb5e361c89716e13b4999b7e663c6ffb5d0cab97d1bc7a3782c6199b91f4b9'
AND (
token = 'W1JIiqkGKsxmLHkET0nQ+3WqByaXBGTo/fyuulZLtLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)