UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8XQPTMA/AJ/evHledWl8RwQK9FcZ0ElRWFBOd6dYpY0='
WHERE
key_id = '85b50559818b55e87513922fca75c0627361b0635b92fba3822603e7a9dd3741'
AND (
token = '8XQPTMA/AJ/evHledWl8RwQK9FcZ0ElRWFBOd6dYpY0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)