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