UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CpYZ5WhDzbBgJMa+t+aOYKbj0FmDwdJBbQ7XfU4Gij0='
WHERE
key_id = '9e04e32154325019bcc31a73ea0a29901da3207edf08391e3456384f939b90f2'
AND (
token = 'CpYZ5WhDzbBgJMa+t+aOYKbj0FmDwdJBbQ7XfU4Gij0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)