UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tqP1XNF9OrgcyvFXeYeouLKUI4dza5EiXOxj59WErZQ='
WHERE
key_id = '71c4fe308e2eb6ed1acd4acbcf52bff45ae54356f2f602684cb7dc75d87a5fe3'
AND (
token = 'tqP1XNF9OrgcyvFXeYeouLKUI4dza5EiXOxj59WErZQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)